package com.example.domain.entity;

import com.example.domain.entity.enums.OrderStatus;
import javax.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单实体类（含结算信息）
 * 
 * <p><strong>注意：订单功能暂未开发，此实体类暂时未使用</strong></p>
 * 
 * <p>此实体类映射数据库表 orders，保留用于数据库表结构管理。</p>
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "orders")
public class Order extends SoftDeleteEntity {

    @Id
    @Column(name = "id", length = 26)
    private String id;

    @Column(name = "cart_id", length = 26, nullable = false)
    private String cartId;

    @Column(name = "user_id", length = 50)
    private String userId;

    @Enumerated(EnumType.STRING)
    @Column(name = "status", length = 20, nullable = false)
    private OrderStatus status = OrderStatus.PENDING_PAYMENT;

    // 金额信息
    @Column(name = "subtotal", precision = 18, scale = 4, nullable = false)
    private BigDecimal subtotal;

    @Column(name = "discount_total", precision = 18, scale = 4)
    private BigDecimal discountTotal = BigDecimal.ZERO;

    @Column(name = "payable_amount", precision = 18, scale = 4, nullable = false)
    private BigDecimal payableAmount;

    // 支付信息
    @Column(name = "payment_id", length = 50)
    private String paymentId;

    @Column(name = "payment_time")
    private LocalDateTime paymentTime;

    // 小票信息
    @Column(name = "receipt_number", length = 50)
    private String receiptNumber;
}

